// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 根据类型id获取分类集合 GET /category/categoryId */
export async function listByTypeId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listByTypeIdParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultListCategory>('/category/categoryId', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 新增分类 POST /category/create */
export async function saveCategory(body: API.Category, options?: { [key: string]: any }) {
  return request<any>('/category/create', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id删除菜品 DELETE /category/delete */
export async function deleteCategoryById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteCategoryByIdParams,
  options?: { [key: string]: any },
) {
  return request<any>('/category/delete', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 批量删除分类 DELETE /category/deletes */
export async function deleteCategoryByIds(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteCategoryByIdsParams,
  options?: { [key: string]: any },
) {
  return request<any>('/category/deletes', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 根据id查询菜品 GET /category/get */
export async function queryCategoryById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryCategoryByIdParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultCategory>('/category/get', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 根据id批量查询菜品 GET /category/gets */
export async function queryCategoryByIds(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryCategoryByIdsParams,
  options?: { [key: string]: any },
) {
  return request<API.CommonResultListCategory>('/category/gets', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 分页查询分类 POST /category/list */
export async function queryCategoryByPage(
  body: API.CategoryPageQuery,
  options?: { [key: string]: any },
) {
  return request<API.PageResponseCategory>('api/category/list', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新分类状态 PUT /category/status/${param0}/${param1} */
export async function updateCategoryStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateCategoryStatusParams,
  options?: { [key: string]: any },
) {
  const { id: param0, status: param1, ...queryParams } = params;
  return request<any>(`/category/status/${param0}/${param1}`, {
    method: 'PUT',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新分类 PUT /category/update */
export async function updateCategory(body: API.Category, options?: { [key: string]: any }) {
  return request<any>('/category/update', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
